import Vue from 'vue';
/**
 * 	表单规则验证
 */





let name = /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,20}$/ ;  // 验证名字
let phone = /^[1][3,4,5,7,8][0-9]{9}$/; // 验证电话
let email = /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/; // 验证邮箱
let idcard = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; //验证身份证号码
let website = "^((https|http|ftp|rtsp|mms)?://)"  // 验证网址
 + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp的user@ 
  + "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP形式的URL- 199.194.52.184 
  + "|" // 允许IP和DOMAIN（域名）
  + "([0-9a-z_!~*'()-]+\.)*" // 域名- www. 
  + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名 
  + "[a-z]{2,6})" // first level domain- .com or .museum 
  + "(:[0-9]{1,4})?" // 端口- :80 
  + "((/?)|" // a slash isn't required if there is no file name 
  + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$"; 

let rule = {
	CompanyName: [ // 公司名称
    { required: true, message:Vue.prototype.$lang('PLACE_COMPANY') , trigger: 'change' },
  ],
  Country : [ // 国家
  	{ required: true, message:Vue.prototype.$lang('PLACE_COMPANY') , trigger: 'change' },
  ],
 	CompanyAddress: [ // 公司地址
    { required: true, message:Vue.prototype.$lang('PLACE_ADDRESS') , trigger: 'change' },
  ],
  CompanyWebsite: [ // 公司网址
    { required: true, message:Vue.prototype.$lang('PLACE_WEBSITE') , trigger: 'change' },
    { pattern:website,message:Vue.prototype.$lang('PLACE_WEBSITE'),trigger: 'change' }
  ],
  ChargeName: [ // 公司地址
    { required: true, message:Vue.prototype.$lang('PLACE_ADDRESS') , trigger: 'change' },
  ],
  ChargePhone: [	// 负责人电话
  	{ required: true, message:Vue.prototype.$lang('DISCLAIMER_PHONE') , trigger: 'change' },
  ]
}
export default rule;